<!DOCTYPE html>

<html>

<head>
    <meta charset="utf-8">
    <title>异常报警</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="//at.alicdn.com/t/font_739294_hnvvzy2r2u.css" media="all">
    <link rel="stylesheet" href="../../layuiadmin/layui/css/my.css" media="all">
</head>
<style>
    .layui-table,
    .layui-table-view {
        margin: 0;
    }
    
    .layui-table-cell {
        font-size: 14px;
        padding: 0 5px;
        height: auto !important;
        overflow: visible;
        text-overflow: inherit;
        white-space: normal;
        word-break: break-all;
    }
    
    body .layui-layer-content {
        padding: 20px;
        font-size: 17px;
    }
    /* 定制化 */
    
    html .layui-layer-demo {
        background-color: #eee;
    }
    
    .layui-layer-demo .layui-layer-title {
        border: none;
        background-color: #333;
        color: #fff;
        font-size: 16px;
        font-weight: bold;
    }
</style>

<body>
    <fieldset class="layui-elem-field layui-field-title">
        <legend>预警信息</legend>
    </fieldset>
    <table id="demo" lay-filter="test"></table>
    <script src="../../layuiadmin/layui/layui.js"></script>
    <script>
        layui.config({
            base: '../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index']);
        layui.use('table', function() {
            var table = layui.table;
            var $ = layui.$;
            var tableIns = table.render({
                elem: '#demo',
                height: 'full-56',
                // data: [],
                url: "../../../warning/warning",
                page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档							
                    limit: 15,
                    limits: [15, 30, 45, 60, 75, 90, 100],
                    theme: "#1e9fff"
                },
                cols: [
                    [ //表头

                        {
                            type: "numbers"
                        }, {
                            field: 'name',
                            title: '预警医院',
                            width: '20%',
                        }, {
                            field: 'pdate',
                            title: '预警日期',
                            width: '10%'
                        }, {
                            field: 'warning',
                            title: '预警内容',
                            width: '60%'
                        }, {
                            title: '反馈',
                            width: '5%',
                            event: "feed",
                            templet: function(d) {
                                if (d.feedback != null && d.feedback != "") {
                                    return "有反馈"
                                } else {
                                    return "无反馈"
                                }
                            }
                        }
                    ]
                ],
                skin: 'row' //表格风格
                    ,
                even: true
            });
            table.on("tool(test)", function(obj) {
                let d = obj.data;
                if (obj.event === "feed" && (d.feedback != null && d.feedback != "")) {
                    layer.open({
                        type: 1,
                        title: "反馈信息",
                        skin: 'layui-layer-demo', //样式类名
                        closeBtn: 1, //不显示关闭按钮
                        anim: 2,
                        shadeClose: true, //开启遮罩关闭
                        content: d.feedback
                    });
                }
            })
            $("#f5").on("click", function() {
                tableIns.reload();
            })
            $("#search").on("click", function() {
                tableIns.reload({
                    url: "../../../Service/getException",
                    where: {
                        hid: $("#hospital option:selected").val()
                    }
                });

            })
        });
    </script>

</body>

</html>